#ifndef WATCHDOG_HPP
#define WATCHDOG_HPP

#include <QObject>
#include <QTimer>

#include "datamemoryorganisation.hpp"

class DataMemoryOrganisation;

/**
* @brief
*
* @class Watchdog watchdog.hpp "watchdog.hpp"
*/
class Watchdog : public QObject
{
Q_OBJECT
public:

    const int MAX_WATCHDOG_TIMER;
    /**
    * @brief Constructor for Watchdog
    *
    * @fn explicit Watchdog(DataMemoryOrganisation *dmo, QObject *parent = 0)
    * @param dmo
    * @param parent
    */
    explicit Watchdog(DataMemoryOrganisation *dmo, QObject *parent = 0);

    /**
    * @brief Copy Constructor for Watchdog
    *
    * @fn Watchdog(const Watchdog &other)
    * @param other
    */
    Watchdog(const Watchdog &other);

    /**
    * @brief Resets the Watchdog Timer
    *
    * @fn void clearWatchdogTimer()
    */
    void clearWatchdogTimer();

    /**
    * @brief Increments the Watchdog Timer
    *
    * @fn void incrementWatchdogTimer()
    */
    void incrementWatchdogTimer();

    /**
    * @brief Returns if watchdog is enabled
    *
    * @fn bool isWatchdogEnabled() const
    * @return bool
    */
    bool isWatchdogEnabled() const;

    /**
    * @brief Enables or disables the Watchdog
    *
    * @fn void setWatchdogEnabled(bool ena)
    * @param ena
    */
    void setWatchdogEnabled(bool ena);

    /**
    * @brief Returns the current timer value as String
    *
    * @fn QString toString()
    * @return QString
    */
    QString toString();

    /**
    * @brief Returns the timer value
    *
    * @fn int getTimer() const
    * @return int
    */
    int getTimer() const;

    /**
    * @brief Returns the DataMemoryOrganisation as pointer
    *
    * @fn const DataMemoryOrganisation *getDataMemoryOrganisation() const
    * @return const DataMemoryOrganisation
    */
    const DataMemoryOrganisation *getDataMemoryOrganisation() const;

private:

    int timer;
    bool watchdogEnabled;
    DataMemoryOrganisation *dataMemoryOrganisation;

signals:

    void watchdogTimeout();


public slots:

};

#endif // WATCHDOG_HPP
